package com.lz.thymeleaf.service;


import com.lz.thymeleaf.dao.UserDao;
import com.lz.thymeleaf.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;


@Service
@Transactional
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;

    //更新用户
    public void updateUser(User user) {
        userDao.updateUser(user);
    }

    //批量删除用户
    public void delUsers(int[] ids){
        for (int id : ids) {
            userDao.delUsers(id);
        }
    }
    //增加用户
   public void addUser(Map<String,String> data){
        userDao.addUser(data);
    }

    //查询所有用户数
   public int findAllUsers(Map<String,Object> params){
        return userDao.findAllUsers(params);
    }
    //分页获取用户
   public List<User> getUsers(Map<String,Object> params) {
       return userDao.getUsers(params);
   }
    //获取用户可视化数
    public List<Map> queryForVisual(){
        return userDao.queryForVisual();
    }
    //获取用户总数，直接获取
    public int findUserCount(){
        return userDao.findUserCount();
    }
    //获取用户地区分布数
    public int findUserAddressNum(){
        return userDao.findUserAddressNum();
    }
}
